Fix http://bugzilla.wikipedia.org/show_bug.cgi?id=538
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 20 Sep 2004 16:23:10 +0000 (16:23 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 20 Sep 2004 16:23:10 +0000 (16:23 +0000)
Return an 'emptyfile' error page if filename is empty.

includes/SpecialUpload.php

index 737c619..c165513 100644 (file)
@@ -112,6 +112,8 @@ class UploadForm {
                global $wgCheckFileExtensions, $wgStrictFileExtensions;
                global $wgFileExtensions, $wgFileBlacklist, $wgUploadSizeWarning;
 
+               /** When using detailed copyright, if user filled field, assume he
+                * confirmed the upload */
                if ( $wgUseCopyrightUpload ) {
                        $this->mUploadAffirm = 1;
                        if ($wgCheckCopyrightUpload && 
@@ -120,12 +122,13 @@ class UploadForm {
                        }
                }
 
+               /** User need to confirm his upload */
                if ( $this->mUploadAffirm != 1) {
                        $this->mainUploadForm( WfMsg( 'noaffirmation' ) );
                        return;
                }
 
-               if ( '' != $this->mOname ) {
+               if ( $this->mOname != '' ) {
                        $basename = strrchr( $this->mOname, '/' );
 
                        if ( false === $basename ) { $basename = $this->mOname; }
@@ -152,7 +155,6 @@ class UploadForm {
                                $basename = $bn;
                        }
 
-
                        $nt = Title::newFromText( $basename );
                        if( !$nt ) {
                                return $this->uploadError( wfMsg( 'illegalfilename', htmlspecialchars( $basename ) ) );
@@ -196,6 +198,9 @@ class UploadForm {
                                }
                                if($warning != '') return $this->uploadWarning($warning);
                        }
+               } else {
+                       return $this->uploadError('<li>'.wfMsg( 'emptyfile' ).'</li>');
+               
                }
                if ( !is_null( $this->mUploadOldVersion ) ) {
                        $wgUploadOldVersion = $this->mUploadOldVersion;